package com.source.lightfowl.person.dao;

import com.source.lightfowl.person.entity.Role_Plate;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional
public interface RolePlateDao extends JpaRepository<Role_Plate,String> {
    Role_Plate findByPid(String pid);

    @Query(
            value = "select * from role_plate where ptype=?1 and bpid=?2 and rid=?3",
            nativeQuery = true
    )
    List<Role_Plate> findByPtypeAndBpid(String ptype, String bpid, String rid);
    List<Role_Plate> findByRid(String rid);
    void deleteByRid(String rid);

    @Query(
            value = "select eids from role_plate where ptype=?1 and bpid=?2 and rid=?3",
            nativeQuery = true
    )
    List<String> findByPAndBp(String p, String bp, String rid);
}
